<script type="text/javascript" src="ckeditor/ckeditor.js"></script>
<script type="text/javascript" language="javascript">
function listSubCategory(cat,sub_cat) 
{
	var category = document.getElementById(cat).value;

	$.post("ajax_file.php", {module:'Classifieds', process:'listClassiCat', category: category}, function (getResult){
		$('#'+sub_cat+' option').remove();
		$('#'+sub_cat).append('<option value=""></option>');
		$('#'+sub_cat).append(getResult);
	});
}

function ListingLevel(val)
	{
		if(val==1)
		{
			document.getElementById('premiumid').style.display='none';
		}
		else
		{
			document.getElementById('premiumid').style.display='inline';
		}
	}
	


</script>


<form name="adsaddfrm" method="post" action="index.php?tc=classifieds_ads_addcode" enctype="multipart/form-data">
<?php
if($_REQUEST['_s'] == 1)
{?>
<table align="center" border="0">
	<tr>
    	<td align="center"><div class="sucmsg"><img src="images/information.png" align="absmiddle" />&nbsp;Submitted successfully</div></td>
    </tr>    
    </table>
<?php } ?>
<?php
if($_REQUEST['_e'] == 1)
{?>
<table align="center" border="0">
	<tr>
    	<td align="center"><div class="sucmsg"><img src="images/error.png" align="absmiddle" />&nbsp;Invalid file format.</div></td>
    </tr>    
    </table>
<?php } ?>
<?php
if($_REQUEST['_e'] == 2)
{?>
<table align="center" border="0">
	<tr>
    	<td align="center"><div class="sucmsg"><img src="images/error.png" align="absmiddle" />&nbsp;Transcation failed. Please try again.</div></td>
    </tr>    
    </table>
<?php } ?>
<table width="99%" align="center" border="0"  class="list" cellpadding="5" cellspacing="0">
<thead>
<tr>
	<td colspan="2" align="left">
        <div style="float:left" class="righthead">Add Business</div>
        <div style="float:right"><a href="index.php?tc=classifieds_ads" class="back">Back</a></div>
    </td>
</tr>
</thead>
<tr>
	<td align="right" width="150">Item to Advertise</td>
    <td align="left"><input class="text" name="item" type="text"/></td>
</tr>
<tr>
	<td align="right" width="150">Short Description</td>
    <td align="left"><textarea name="desc" cols="30" rows="4" wrap="soft"></textarea></td>
</tr>
<tr>
	<td align="right" width="150">Category</td>
    <td align="left">
    	<select name="category" id="category" onchange="listSubCategory('category','sub_category');">
    		<?php 
			$sql = "SELECT * FROM classifieds_category WHERE active_status='1'";
			$res = mysql_query($sql) or die(mysql_error());
			$i=1;
			while($data = mysql_fetch_array($res)) {
				echo '<option value="'.$data['id'].'"  >'.stripslashes($data['category']).'</option>';
			}
			?>
       </select>     
      </td> 
</tr>
<tr>
	<td align="right" width="150">Sub Category</td>
    <td align="left">
    	<select name="sub_category" id="sub_category">
    		<?php 
			$sql = "SELECT * FROM classifieds_subcategory WHERE active_status='1'";
			$res = mysql_query($sql) or die(mysql_error());
			$i=1;
			while($data = mysql_fetch_array($res)) {
				echo '<option value="'.$data['id'].'"  >'.stripslashes($data['sub_cat_name']).'</option>';
			}
			?>
       </select>     
      </td> 
</tr>
<tr>
	<td align="right" width="150">Listing Level</td>
    <td align="left">
        	<input type="radio" name="listinglevel" value="1" checked="checked" onclick="ListingLevel(this.value)"  />&nbsp;STANDARD (2 categories)<br />
            <input type="radio" name="listinglevel" value="2" onclick="ListingLevel(this.value)"  />&nbsp;PREMIUM (4 categories)
   	</td>
</tr>
<thead>
<tr>
	<td colspan="2" align="left">
        <div style="float:left">Business Template Details</div>
    </td>
</tr>
</thead>
<tr>
    	<td colspan="2" align="center">
            	<table width="100%" align="center" border="0" cellpadding="0" cellspacing="0">
                <tr>
                	<td align="right" width="150">Image 1</td>
                    <td align="left"><input type="file" name="tempimage1" /></td>
                </tr>
                <tr>
                	<td align="right" width="150">Image 2</td>
                    <td align="left"><input type="file" name="tempimage2"  /></td>
                </tr>
                </table>
            <div id="premiumid" style="display:none">
            	<table width="100%" align="center" border="0" cellpadding="0" cellspacing="0">
                <tr>
                	<td align="right" width="150">Image 3</td>
                    <td align="left"><input type="file" name="tempimage3" /></td>
                </tr>
                <tr>
                	<td align="right" width="150">Image 4</td>
                    <td align="left"><input type="file" name="tempimage4"  /></td>
                </tr>
                <tr>
                	<td align="right" width="150">Image 5</td>
                    <td align="left"><input type="file" name="tempimage5"  /></td>
                </tr>
                <tr>
                	<td align="right" width="150">Image 6</td>
                    <td align="left"><input type="file" name="tempimage6"  /></td>
                </tr>    
                </table>
            </div>
        </td>
	</tr> 
<thead>
<tr>
	<td colspan="2" align="left">
        <div style="float:left">Business Contact Details</div>
    </td>
</tr>
</thead>
<tr>
	<td align="right" width="150">Contact Email</td>
    <td align="left">
	<input type="text" name="contactemail" class="text"  />
	</td>
</tr>
<tr>
	<td align="right" width="150">Show Contact Email</td>
    <td align="left">
	<input type="radio" value="1" name="showcontactemail" />&nbsp;Yes&nbsp;&nbsp;
    <input type="radio" value="0" name="showcontactemail" checked />No
	</td>
</tr>
<tr>
	<td align="right" width="150">Address 1</td>
    <td align="left">
	<input type="text" name="address1" class="text" />
	</td>
</tr>
<tr>
	<td align="right" width="150">Address 2</td>
    <td align="left">
	<input type="text" name="address2" class="text" />
	</td>
</tr>
<tr>
	<td align="right" width="150">City</td>
    <td align="left">
	<input type="text" name="city" class="text" />
	</td>
</tr>
<tr>
	<td align="right" width="150">State</td>
    <td align="left">
	<input type="text" name="state" class="text" />
	</td>
</tr>
<tr>
	<td align="right" width="150">Postcode</td>
    <td align="left">
	<input type="text" name="postcode" class="text" />
	</td>
</tr>
<tr>
	<td align="right" width="150">Phone</td>
    <td align="left">
	<input type="text" name="phone" class="text" />
	</td>
</tr>
<tr>
	<td align="right" width="150">Fax</td>
    <td align="left">
	<input type="text" name="fax" class="text" />
	</td>
</tr>
<thead>
<tr>
	<td colspan="2" align="left">
        <div style="float:left">Business Long Description</div>
    </td>
</tr>
</thead>
<tr>
	<td colspan="2" align="left">
    <textarea name="maincont" id="maincont" class="textarea" cols="25" rows="5"></textarea>
     <script type="text/javascript">CKEDITOR.replace( 'maincont',{skin : 'kama'});</script>
     
        	
    </td>
</tr>
<tr>
    	<td align="left" colspan="2">
        	<input type="submit" value="Save and Submit for Approval" name="save_approval" />&nbsp;<input type="reset" value="Clear" />
        </td>
  	</tr> 
</table>
</form>